<template>
  <div class="Index">
    <!-- <ChinaMap></ChinaMap> -->
<!-- 左 -->.
  <div id="container"  @dblclick="backMap"></div>
     <div  id="buttonright">
       <Left></Left>
     </div>
     <div id="rights" @click="pande">{{intertext}}</div>
    <!-- 右 -->
    <div id="buttonrightone">
      <Right></Right>
    </div>
    <!-- <div id="rightsjian" @click=" panderight">{{intertextright}}</div> -->
    <!-- <Left id="buttonleft" style="transition: all 5s"></Left> -->
    <!-- <div @click="pande" id="rights">{{ intertext }}</div/> -->
    <!-- 右侧 -->
    <!-- <div id="buttonrightone" style="transition: all 5s"> -->
    <!-- <Right></Right> -->
    <!-- </div> -->
    <div @click="panderight" id="rightsjian">{{ intertextright }}</div>
  </div>
</template>

<script>
// import ChinaMap from "./ChinaMap";
import Left from "./left.vue";
// import Right from "./right.vue";
import Right from "../../zujian/executeCheckright.vue";
import echarts from "echarts";
import "echarts/map/js/china.js"; // 引入中国地图数据
import MapData from "./MapData.json";


export default {
  components: {
    // ChinaMap,
    Left,
    Right
  },
  data() {
    return {
      drawersright: true,
      intertextright: ">",
      drawers: true,
      intertext: "<",
    };
  },
  mounted(){
     this.MapData();
  },
  methods: {
     backMap(){
       this.$router.go(-1)
     },
    // 右侧隐藏
    panderight() {
      // console.log(this.drawers);
      let rights = document.getElementById("rightsjian");
      let buttonright = document.getElementById("buttonrightone");
      if (this.drawersright) {
        this.drawersright = false;
      
        rights.innerText = "<";
       
        rights.style.right = "40px";
        buttonright.style.opacity = 0;
        buttonright.style.transition = "all 0.5s";
        rights.style.transition = "all 0.5s";
      } else {
       
        rights.innerText = ">";
        this.drawersright = true;
        buttonright.style.opacity = 1;
        buttonright.style.transition = "all 0.5s";
        rights.style.right = "540px";
      }
    },
    pande() {
      console.log(this.drawers);
      let rights = document.getElementById("rights");
      let buttonright = document.getElementById("buttonright");
    
       if (this.drawersright) {
        this.drawersright = false;
        rights.innerText = ">";
        rights.style.left = "40px";
        buttonright.style.opacity = 0;
        buttonright.style.transition = "all 0.5s";
        rights.style.transition = "all 0.5s";
      } else {
       
        rights.innerText = "<";
        this.drawersright = true;
        buttonright.style.opacity = 1;
        buttonright.style.transition = "all 0.5s";
        rights.style.left = "490px";
      }
    },
    // 省份地图
    MapData() {
      var myChart = echarts.init(document.getElementById("container"));
      console.log(MapData);
      echarts.registerMap("北京", MapData);
      var option = {
        tooltip: {
          show: true, //是否显示提示框组件，包括提示框浮层和 axisPointer。 [ default: true ]
          trigger: "item", //触发类型。 [ default: 'item' ]
          showDelay: 0,
          transitionDuration: 0.2,
          // formatter: function(params) {
          //   // alert(params);
          //   return params.name;
          // },
        },
        title: {
          text: "",
          x: "center",
        },
        geo: {
          map: "北京",
          label: {
            normal: {
              show: true, //关闭省份名展示
              fontSize: "14",
              color: "rgba(0,0,0,0.7)",
            },
          },
          roam: true,
          // zoom:1.5,
          itemStyle: {},
        },
        series: [
          {
            type: "effectScatter",
            coordinateSystem: "geo",
            rippleEffect: {
              brushType: "stroke",
            },
            symbolSize: function(val, params) {
              return 8;
            },
            data: [],
          },
        ],
      };
      myChart.setOption(option);
      window.addEventListener("resize", function() {
        myChart.resize();
      });
      //绑定点击事件
      myChart.on("click", (param) => {
        // alert(param.name);
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.Index {
  position: relative;
  /* position: fixed; */
  flex-flow: wrap;
}
#container {
  width: 100%;
  height: 100vh;
  margin: 0 auto;
}
.zhong {
  width: 400px;
  height: 500px;
  position: absolute;
  left: 0;
  right: 0;
  margin: auto;
  // border: solid 1px #020202;
  z-index: 99;
  // background: #ccc;
  top: -150px;
}
#buttonrightone {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 515px;
  // height: 945px;
  // overflow: hidden;
  // border-bottom: solid 1px #ccc;
}
#rightsjian {
  position: fixed;
  right: 538px;
  top: 50vh;
  /* bottom: 0px; */
  /* margin: auto; */
  width: 35px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  background: rgb(253, 253, 253);
  cursor: pointer;
  border-radius: 10px 0 0 10px;
  font-size: 32px;
  font-weight: 500;
  color: #999999;
}

.Left {
  position: absolute;
  top: 20px;
  left: 20px;
}
.LeftBtn {
  position: absolute;
  top: 450px;
  left: 539px;
}
// .RightNext {
//   position: absolute;
//   top: 306px;
//   left: 1267px;
// }
.LeftNext {
  position: absolute;
  top: 306px;
  left: 20px;
}
#rights {
  // box-shadow: 0px 0px 20px gainsboro;
  position: fixed;
  left: 490px;
  top: 50vh;
  width: 35px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  background: rgb(253, 253, 253);
  cursor: pointer;
  border-radius: 0 10px 10px 0;
  font-size: 32px;
  color: #999999;
  z-index: 999;
}
#rightsjian::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background: #fff;
  /* transform: perspective(.5em) rotateX(5deg); */
  transform: perspective(0.5em) rotateY(-12deg);
  background: -webkit-gradient(
    linear,
    0 0,
    0 bottom,
    from(#f3f5f7),
    to(#fdfeff)
  );
}
#rights::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background: #fff;
  /* transform: perspective(.5em) rotateX(5deg); */
  transform: perspective(0.5em) rotateY(12deg);
  background: -webkit-gradient(
    linear,
    0 0,
    0 bottom,
    from(#f3f5f7),
    to(#fdfeff)
  );
}
</style>
